/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.agenda.model.entity;

import java.io.Serializable;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Ronildo
 */
@Entity
@Table(name = "AM_TB_AGEN_MEDI")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "AmTbAgenMedi.findAll", query = "SELECT a FROM AmTbAgenMedi a"),
    @NamedQuery(name = "AmTbAgenMedi.findByNrSequAgenMedi", query = "SELECT a FROM AmTbAgenMedi a WHERE a.nrSequAgenMedi = :nrSequAgenMedi"),
    @NamedQuery(name = "AmTbAgenMedi.findByDtRefe", query = "SELECT a FROM AmTbAgenMedi a WHERE a.dtRefe = :dtRefe"),
    @NamedQuery(name = "AmTbAgenMedi.findByHrInicCmpr", query = "SELECT a FROM AmTbAgenMedi a WHERE a.hrInicCmpr = :hrInicCmpr"),
    @NamedQuery(name = "AmTbAgenMedi.findByHrTermCmpr", query = "SELECT a FROM AmTbAgenMedi a WHERE a.hrTermCmpr = :hrTermCmpr"),
    @NamedQuery(name = "AmTbAgenMedi.findByDtUltiAtua", query = "SELECT a FROM AmTbAgenMedi a WHERE a.dtUltiAtua = :dtUltiAtua")})
public class AmTbAgenMedi implements Serializable {
    private static final long serialVersionUID = 1L;
    
    @Id
    @Basic(optional = false)
    @Column(name = "NR_SEQU_AGEN_MEDI")
    @GeneratedValue(strategy=GenerationType.SEQUENCE, generator = "SEQ_AM_TB_AGEN_MEDI")
    @SequenceGenerator(name="SEQ_AM_TB_AGEN_MEDI", sequenceName = "SEQ_AM_TB_AGEN_MEDI")
    private Long nrSequAgenMedi;
    
    @Basic(optional = false)
    @NotNull
    @Column(name = "DT_REFE")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dtRefe;
    @Basic(optional = false)
    @NotNull
    @Column(name = "HR_INIC_CMPR")
    private short hrInicCmpr;
    @Column(name = "HR_TERM_CMPR")
    private Short hrTermCmpr;
    @Basic(optional = false)
    @NotNull
    @Column(name = "DT_ULTI_ATUA")
    @Temporal(TemporalType.TIMESTAMP)
    private Date dtUltiAtua;
    @JoinColumn(name = "CD_SITU_AGEN_MEDI", referencedColumnName = "CD_SITU_AGEN_MEDI")
    @ManyToOne(optional = false)
    private AmTbSituAgenMedi cdSituAgenMedi;
    @JoinColumn(name = "CD_USUA_PACI", referencedColumnName = "CD_USUA_PACI")
    @ManyToOne
    private AmTbPaci cdUsuaPaci;
    @JoinColumn(name = "CD_LOCA_ATEN_MEDI", referencedColumnName = "CD_LOCA_ATEN_MEDI")
    @ManyToOne(optional = false)
    private AmTbLocaAtenMedi cdLocaAtenMedi;

    public AmTbAgenMedi() {
    }

    public AmTbAgenMedi(Long nrSequAgenMedi) {
        this.nrSequAgenMedi = nrSequAgenMedi;
    }

    public AmTbAgenMedi(Long nrSequAgenMedi, Date dtRefe, short hrInicCmpr, Date dtUltiAtua) {
        this.nrSequAgenMedi = nrSequAgenMedi;
        this.dtRefe = dtRefe;
        this.hrInicCmpr = hrInicCmpr;
        this.dtUltiAtua = dtUltiAtua;
    }

    public Long getNrSequAgenMedi() {
        return nrSequAgenMedi;
    }

    public void setNrSequAgenMedi(Long nrSequAgenMedi) {
        this.nrSequAgenMedi = nrSequAgenMedi;
    }

    public Date getDtRefe() {
        return dtRefe;
    }

    public void setDtRefe(Date dtRefe) {
        this.dtRefe = dtRefe;
    }

    public short getHrInicCmpr() {
        return hrInicCmpr;
    }

    public void setHrInicCmpr(short hrInicCmpr) {
        this.hrInicCmpr = hrInicCmpr;
    }

    public Short getHrTermCmpr() {
        return hrTermCmpr;
    }

    public void setHrTermCmpr(Short hrTermCmpr) {
        this.hrTermCmpr = hrTermCmpr;
    }

    public Date getDtUltiAtua() {
        return dtUltiAtua;
    }

    public void setDtUltiAtua(Date dtUltiAtua) {
        this.dtUltiAtua = dtUltiAtua;
    }

    public AmTbSituAgenMedi getCdSituAgenMedi() {
        return cdSituAgenMedi;
    }

    public void setCdSituAgenMedi(AmTbSituAgenMedi cdSituAgenMedi) {
        this.cdSituAgenMedi = cdSituAgenMedi;
    }

    public AmTbPaci getCdUsuaPaci() {
        return cdUsuaPaci;
    }

    public void setCdUsuaPaci(AmTbPaci cdUsuaPaci) {
        this.cdUsuaPaci = cdUsuaPaci;
    }

    public AmTbLocaAtenMedi getCdLocaAtenMedi() {
        return cdLocaAtenMedi;
    }

    public void setCdLocaAtenMedi(AmTbLocaAtenMedi cdLocaAtenMedi) {
        this.cdLocaAtenMedi = cdLocaAtenMedi;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (nrSequAgenMedi != null ? nrSequAgenMedi.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof AmTbAgenMedi)) {
            return false;
        }
        AmTbAgenMedi other = (AmTbAgenMedi) object;
        if ((this.nrSequAgenMedi == null && other.nrSequAgenMedi != null) || (this.nrSequAgenMedi != null && !this.nrSequAgenMedi.equals(other.nrSequAgenMedi))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.agenda.model.entity.AmTbAgenMedi[ nrSequAgenMedi=" + nrSequAgenMedi + " ]";
    }
    
}
